package com.yukino.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yukino.pojo.Progress;
import com.yukino.service.ProgressService;
import com.yukino.mapper.ProgressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProgressServiceImpl implements ProgressService {
    @Autowired
    private ProgressMapper progressMapper;

    /**
     * 查询单独项目的所有提交进度
     * @param project_id 项目id
     */
    @Override
    public List<Progress> queryProgress(Long project_id) {
        return progressMapper.selectList(new QueryWrapper<Progress>().eq("project_id", project_id));
    }

    /**
     * 提交进度
     * @param project_id        项目id
     * @param commit_name       提交者
     * @param commit_remark     提交备注
     */
    @Override
    public int addOne(Long project_id, String commit_name, String commit_remark) {
        Progress p = new Progress();
        p.setProject_id(project_id);
        p.setCommit_name(commit_name);
        p.setCommit_remark(commit_remark);

        return progressMapper.insert(p);
    }
}




